<?php
/**
 * Copyright 2010 Jesse Cool Diary
 *
 */



//update the option
if(isset($_REQUEST['action'])&&$_REQUEST['action']=='update'){
		
		$coolDiary;
		$mood = $_REQUEST['mood'];
		$weather = $_REQUEST['weather'];
		
		
		if($mood == 1){
			$coolDiary['mood'] = $mood;
			//update_option(COOL_DIAEY_PRIFIX.'mood',$mood);
		}else{
			$coolDiary['mood'] = '';
			//delete_option(COOL_DIAEY_PRIFIX.'mood');
		}
		if($weather == 1){
			
			
			//update_option(COOL_DIAEY_PRIFIX.'weather',$weather);
			
			$weather_setting = $_REQUEST['weather_method'];
			if($weather_setting=='ip'){//belong ip
				$coolDiary['weather'] = array('method'=>'ip');
			//update_option(COOL_DIAEY_PRIFIX.'weather_setting','ip');
				
			}elseif($weather_setting=='city'){
				$coolDiary['weather'] = array('method'=>'city','city'=>$_REQUEST['weather_city']);
//				$coolDiary_weather['setting'] = 'city';
//				$coolDiary_weather['city'] = $_REQUEST['weather_city'];
				
				//update_option(COOL_DIAEY_PRIFIX.'weather_setting','city');
				//update_option(COOL_DIAEY_PRIFIX.'weather_city',$_REQUEST['weather_city']);
			
			}
			
		}else{
			$coolDiary['weather'] = '';
			//delete_option(COOL_DIAEY_PRIFIX.'weather');
		}
		
	update_option(COOL_DIAEY,$coolDiary);
	
}

$coolDiary = get_option(COOL_DIAEY);


?>


<div id="ppt-wrap" class="wrap">
<div id="icon-options-general" class="icon32"><br />
</div>

<h2>Cool Diary Setting</h2>
<p>This is the cool diary setting page.In this page you can set how to
manager your blog like a diary.<br>
You can make the password available,and login only when vistors to visit
your diary.<br>
Last,may you can record all the moment and always enjoy your life.
 

</p>

<hr class="ppt-hr" />

 
<form method="post"> 
 <input type='hidden' name='action' value='update' />
<h3 class="title">Mood &amp; Weather</h3> 
<p>This fieldset let you to manage the mood and the weather in your posts.</p> 

<table class="form-table"> 
<tr valign="top"> 
<th scope="row">Mood</th> 
<td>  

  	<input name="mood" type="checkbox" id="mood" value="1" <?php echo $coolDiary['mood']==1? 'checked':'' ?>/>
    Available   
    </td>

</tr> 
<tr valign="top"> 
<th scope="row"><label for="mailserver_login">Weather</label></th> 
<td><input name="weather" type="checkbox" id="weather" value="1"  <?php echo $coolDiary['weather']? 'checked':'' ?>/>
Available

<fieldset id="mood setting">
    <table>
  <tr>
  	<?php $weather_setting = get_option(COOL_DIAEY_PRIFIX.'weather_setting');?>
    <td><input name="weather_method" type="radio" value="ip" <?php echo $coolDiary['weather']['method']=='ip'? 'checked':'' ?>/> 
      根据IP<br>
    <input name="weather_method" type="radio" value="city"  <?php echo $coolDiary['weather']['method']=='city'? 'checked':'' ?>/> 
      自己设定<input name="weather_city" type="text" value="<?php echo $coolDiary['weather']['city'] ?>" size="10" />
    </td>
  </tr>
</table>

  </fieldset>


</td> 
</tr> 

</table> 
 
<h3>Access</h3> 
<p>You can manage who can visit your diary .</p> 
<table class="form-table"> 
<tr valign="top"> 
<th scope="row"><label for="mailserver_pass">密码</label></th> 
<td> 
<input name="mailserver_pass" type="text" id="mailserver_pass" value="password" class="regular-text" /> 
</td> 
</tr> 
<tr valign="top"> 
<th scope="row"><label for="default_email_category"><?php echo __('Everyone') ?></label></th> 
<td> 
<select name='default_email_category' id='default_email_category' class='postform' > 
	<option class="level-0" value="1" selected="selected">未分类</option> 
</select> 
</td> 
</tr> 


<tr valign="top"> 
<th scope="row">Atom 发布协议</th> 
<td><fieldset><legend class="screen-reader-text"><span>Atom 发布协议</span></legend> 
<label for="enable_app"> 
<input name="enable_app" type="checkbox" id="enable_app" value="1"  /> 
启用 Atom 发布协议</label><br /> 
</fieldset></td> 
</tr> 
<tr valign="top"> 
<th scope="row">XML-RPC</th> 
<td><fieldset><legend class="screen-reader-text"><span>XML-RPC</span></legend> 
<label for="enable_xmlrpc"> 
<input name="enable_xmlrpc" type="checkbox" id="enable_xmlrpc" value="1"  /> 
启用 WordPress、Movable Type、MetaWeblog 和 Blogger 的 XML-RPC 发布协议</label><br /> 
</fieldset></td> 
</tr> 
</table> 
 
<h3>Display</h3> 
 
 
<p><label for="ping_sites">当您发布一篇新日志时，WordPress 会自动通告下列地址，以通知这些网站更新。想了解更多，请参考 WordPress 文档中的 <a href="http://codex.wordpress.org/Update_Services">更新通知</a> 部分。<br />每个通知地址各占一行。</label></p> 
 
<textarea name="ping_sites" id="ping_sites" class="large-text code" rows="3">http://rpc.pingomatic.com/</textarea> 
 
 
 
<p class="submit"> 
	<input type="submit" name="Submit" class="button-primary" value="Save..." /> 
</p> 
</form> 
</div> 
 
 
<div class="clear"></div><!-- wpbody-content --> 
<div class="clear"></div><!-- wpbody --> 
<div class="clear"></div><!-- wpcontent --> 
